<template>
  <div class="page">
    <div class="bg"></div>
    <Breadcrumbs></Breadcrumbs>
    <div class="container card">
      <Search @search="getkeyword"></Search>
      <div class="card-body">
        <div
          v-if="tableData.length == 0"
          style="text-align: center; margin: 41px; color: rgb(133, 132, 132)"
        >
          暂无数据
        </div>
        <div class="list" v-for="item in tableData" :key="item.docId" @click="goDetail(item)">
          <div class="tiem">
            <div>
              {{ splitDate(item.fbrq)["month"] }}-{{
                splitDate(item.fbrq)["day"]
              }}
            </div>
            <div>{{ splitDate(item.fbrq)["year"] }}</div>
          </div>
          <div class="list_info">
            <div class="list_info_title line_1">
              {{ item.bt }}
            </div>
            <div class="list_info_dis line_2">
              {{ item.fbt }}
            </div>
          </div>
          <div class="list_more"></div>
        </div>
        <Pagination
          :page.sync="pageNum"
          :limit.sync="pageSize"
          :total="total"
          @pagination="getData"
        ></Pagination>
      </div>
    </div>
    <div style="padding-top: 90px"></div>
  </div>
</template>
<script>
import Search from "@/components/Search.vue";
import { splitDate } from "../../utils/index.js";
export default {
  name: "transaction",
  components: {
    Search,
  },
  data() {
    return {
      pageSize: 10,
      pageNum: 1,
      total: 0,
      tableData: [],
      keyWord: "",
    };
  },
  created() {
    this.getData();
  },
  methods: {
      goDetail(row){
      this.$router.push({
        path: "/detail",
        query: {
          docId:row.docId,
        },
      });
    },
    getData() {
      this.$api
        .docListAPI({
          pageNum: this.pageNum,
          pageSize: this.pageSize,
          cd: this.$route.name,
          keyword:this.keyWord
        })
        .then((item) => {
          let { list, total } = item.data;
          this.tableData = list;
          this.total = total;
        });
    },
    getkeyword(e){
      this.keyWord = e;
      this.pageNum = 1;
      this.total = 0;
      this.pageSize = 10;
      this.getData();
    },
    splitDate(date) {
      return splitDate(date);
    },
  },
};
</script>
<style scoped>
.list {
  display: flex;
  align-items: center;
  padding: 31px;
  border-bottom: 1px solid #e5e5e5;
  /* height: 60px; */
}
.list .tiem {
  width: 60px;
  height: 60px;
  background: #f8f8f8;
  flex-shrink: 0;
  margin-right: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #000000;
}
.list:hover .tiem {
  color: rgb(255, 255, 255);
  background: #2959b0;
}
.list .tiem div:nth-child(1) {
  margin-bottom: 13px;
}
.list .tiem div:nth-child(2) {
  font-size: 12px;
}
.list .list_info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-right: 31px;
}
.list .list_info .list_info_title {
  font-size: 18px;
  font-weight: 700;
  color: #333333;
}
.list:hover .list_info .list_info_title {
  color: #2959b0;
}
.list .list_info .list_info_dis {
  margin-top: 21px;
  font-size: 14px;
  color: #9e9e9e;
  line-height: 20px;
}
.list:hover .list_more {
  background-image: url("@/static/icon/jy_icon_hover.png");
}
.list .list_more {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-image: url("@/static/icon/jy_icon.png");
  background-repeat: no-repeat;
  background-size: contain;
}
.bg {
  height: 300px;
  background-image: url("@/static/img/yxgk.png");
  background-repeat: no-repeat;
  background-size: cover;
}
.page {
  background-color: #fbfbfb;
}

.card {
  margin-top: 42px;
  background: #ffffff;
  box-shadow: 6px 6px 10px 0px rgba(0, 0, 0, 0.04);
}
</style>